package com.geek.javaes.game;

// 装备基类
class Equipment {
    private String name;         // 装备名称
    private int attackBonus;     // 攻击力加成
    private int defenseBonus;    // 防御力加成

    public Equipment(String name, int attackBonus, int defenseBonus) {
        this.name = name;
        this.attackBonus = attackBonus;
        this.defenseBonus = defenseBonus;
    }

    // 获取装备名称
    public String getName() {
        return name;
    }

    // 获取攻击力加成
    public int getAttackBonus() {
        return attackBonus;
    }

    // 获取防御力加成
    public int getDefenseBonus() {
        return defenseBonus;
    }

    // 装备描述（可被子类重写）
    public String getDescription() {
        return name + "（攻击+" + attackBonus + "，防御+" + defenseBonus + "）";
    }
}

// 剑（攻击型装备）
class Sword extends Equipment {
    public Sword(String name, int attackBonus) {
        super(name, attackBonus, 0); // 剑的防御加成为 0
    }

    @Override
    public String getDescription() {
        return "武器：" + super.getDescription();
    }
}

// 护甲（防御型装备）
class Armor extends Equipment {
    public Armor(String name, int defenseBonus) {
        super(name, 0, defenseBonus); // 护甲的攻击加成为 0
    }

    @Override
    public String getDescription() {
        return "防具：" + super.getDescription();
    }
}
